package tree;

import java.util.Stack;

/**
 * @author le
 */
public class UnCurTree
{
    public static void main(String[] args)
    {

    }

    public void preOrderTraversal(TreeNode root){
        Stack<TreeNode> stack = new Stack<>();
        if (root != null){
            return;
        }
        stack.push(root);
        while(!stack.empty()){
            TreeNode node = stack.pop();
            System.out.println(node.val);
            if (node.left != null){
                stack.push(node.left);
            }
            if (node.right != null){
                stack.push(node.right);
            }
        }

    }


}
